<?if($this->errorMessage) {?>
    <h4 class="alert_error"><?=$this->errorMessage?></h4>
<? } ?>

<?if($this->isUpdate) {?>
    <h4 class="alert_success">Редактирование успешно завершено!</h4>
<? } ?>

<div class="form">
<form method="POST" action="<?$this->url(array('controller'=>'products', 'action'=>'add'))?>">
    <div>
        <label>Категория:</label>
        <select name="category_id">
            <?foreach($this->categories as $index => $value) {?>
                <option value="<?=$value->id?>" <?=($this->product['category_id'] == $value->id) ? 'selected' : ''?>>
                    <?=$value->name?>
                </option>
            <? } ?>
        </select>
    </div>
    <div><label>Название: </label><input type="text" value="<?=$this->product['name']?>" name='name'></div>
    <div><label>Цена</label><input type="text" name="price" value="<?=$this->product['price']?>"></div>
    <div><label>Старая цена</label><input type="text" name="old_price" value="<?=$this->product['old_pirce']?>"></div>
    <div><label>Количество</label><input type="text" name="count" value="<?=$this->product['count']?>"></div>
    <div>
        <label>Краткое описание:</label>
        <textarea rows="3" cols="30" name="short_description"><?=$this->product['short_description']?></textarea>
    </div>
    <div>
        <label>Полное описание:</label>
        <textarea rows="3" cols="30" name="full_description"><?=$this->product['full_description']?></textarea>
    </div>
    <div>
        <label>Картинка: </label>
        <?if($this->product['picture_url']) {?>
            <img src='<?=$this->product['picture_url']?>'>
        <? } ?>
        <input type="file" name="picture_url">
    </div>
    <div>
        <div>
        <label>Отображать</label>
        Да<input type="radio" name="is_visible" value="1" <?=($this->product['is_visible'] === 1) ? 'checked' : ''?>>
        Нет<input type="radio" name="is_visible" value="0" <?=($this->product['is_visible'] === 0) ? 'checked' : ''?>>
        </div>
    </div>

    <div>
        <div>
        <label>Новый товар</label>
        Да<input type="radio" name="is_new" value="1" <?=($this->product['is_new'] === 1) ? 'checked' : ''?>>
        Нет<input type="radio" name="is_new" value="0" <?=($this->product['is_visible'] === 0) ? 'checked' : ''?>>
        </div>
    </div>


    <input type="submit" name="submit" value="редактировать">
</form>
</div>

